package com.atguigu.srb.core.service;

import com.atguigu.srb.common.result.R;
import com.atguigu.srb.core.entity.UserAccount;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

/**
 * <p>
 * 用户账户 服务类
 * </p>
 *
 * @author Atguigu
 * @since 2023-06-30
 */
public interface UserAccountService extends IService<UserAccount> {

    String handleRecharge(BigDecimal amount, String token);

    String callback(Map<String, Object> params);

    BigDecimal getAmount(Long userId);

    BigDecimal expectAmount(Integer period, BigDecimal yearRate, Integer returnMethod, BigDecimal amount);

    // 根据用户的id更新账户和冻结账户
    Integer updateAmountAndFreezeAmountByUserId(BigDecimal amount, BigDecimal freezeAmount, Long userId, Date updateTime);

    // 根据用户的bindCode更新账户和冻结账户
    Integer updateAmountAndFreezeAmountByBindCode(BigDecimal amount, BigDecimal freezeAmount, String bindCode, Date updateTime);

    String withDraw(String token, BigDecimal amount);

    String withDrawCallback(Map<String, Object> map);
}
